<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <f:metadata>
        <f:viewParam name="email" value="#{userDataBean.email}"></f:viewParam>
        <f:viewAction action="#{userDataBean.init}"/>
    </f:metadata>
    <h:head>
        <title>homepage</title>
        <style>@import url("../resources/css/homepageCSS1.css")</style>

    </h:head>
    <h:body>
        <p:layout fullPage="true">
            <p:layoutUnit styleClass="topLayout" position="north" size="100" resizable="true">

                <img id="titleImg" src="../resources/images/titolo90.png" alt="METEOCAL"/>
                <div id="userBlock">
                    <h:form>
                        <p:outputLabel>
                            #{userBean.name}&nbsp;&nbsp;&nbsp;<b>|</b>&nbsp;&nbsp;&nbsp;
                        </p:outputLabel>
                        <p:link style="color: blue;" value="Home" outcome="home?faces-redirect=true"/>
                        <p:outputLabel>
                            &nbsp;&nbsp;&nbsp;<b>|</b>&nbsp;&nbsp;&nbsp;
                        </p:outputLabel>
                        <p:commandLink style="color: blue;" action="#{loginBean.logout()}" value="Logout"/>
                    </h:form>
                </div>
                <div id="otherUser">
                    <p:outputLabel>
                        Calendar for #{userDataBean.email}
                    </p:outputLabel>
                </div>
            </p:layoutUnit>

            <p:layoutUnit styleClass="centralBlock" position="center">
                <div id="schedPanel" align="center">
                    <h:form rendered="#{userDataBean.privateCal}">
                        <div>This calendar is private.</div>
                    </h:form>
                    <h:form rendered="#{!userDataBean.privateCal}">
                        <p:schedule style=" opacity: 0.92" id="schedule" value="#{userDataBean.eventModel}" widgetVar="myschedule" timeZone="GMT+1" draggable="false" resizable="false">
                            <p:ajax event="eventSelect" update="eventDetails" listener="#{userDataBean.onEventSelect}" oncomplete="PF('eventDialog').show();" />
                        </p:schedule>

                        <p:dialog widgetVar="eventDialog" header="Event Details" showEffect="clip" hideEffect="clip">
                            <h:panelGrid id="eventDetails" columns="2">
                                <h:outputLabel for="title" value="Title:" />
                                <h:outputLabel id="title" value="#{userDataBean.selectedEvent.title}"/>

                                <h:outputLabel for="from" value="From:" />
                                <h:outputLabel id="from" value="#{userDataBean.selectedEvent.startDate}">
                                    <f:convertDateTime pattern="MM/dd/yyyy &nbsp;-&nbsp; HH:mm" timeZone="GMT+1"/>
                                </h:outputLabel>

                                <h:outputLabel for="to" value="To:" />
                                <h:outputLabel id="to" value="#{userDataBean.selectedEvent.endDate}">
                                    <f:convertDateTime pattern="MM/dd/yyyy &nbsp;-&nbsp; HH:mm" timeZone="GMT+1"/>
                                </h:outputLabel>
                            </h:panelGrid>
                            <p:commandButton value="Details" action="#{userDataBean.redirectToEvent}"/>
                        </p:dialog>
                    </h:form>
                </div>
            </p:layoutUnit>
        </p:layout>
    </h:body>
</html>

